package week9;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class Account
{
  private String mobilePhone = "";
  private String email = "";

  public Account()
  {
  }

  public Account(String paramString1, String paramString2)
  {
    this.mobilePhone = paramString1;
    this.email = paramString2;
  }

  public String getMobilePhone()
  {
    return this.mobilePhone;
  }

  public void setMobilePhone(String paramString)
  {
    this.mobilePhone = paramString;
  }

  public String getEmail()
  {
    return this.email;
  }

  public void setEmail(String paramString)
  {
    this.email = paramString;
  }

  public byte[] serialize()
    throws IOException
  {
    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
    DataOutputStream localDataOutputStream = new DataOutputStream(localByteArrayOutputStream);
    localDataOutputStream.writeUTF(this.mobilePhone);
    localDataOutputStream.writeUTF(this.email);
    localByteArrayOutputStream.close();
    localDataOutputStream.close();
    return localByteArrayOutputStream.toByteArray();
  }

  public static Account deserialize(byte[] paramArrayOfByte)
    throws IOException
  {
    ByteArrayInputStream localByteArrayInputStream = new ByteArrayInputStream(paramArrayOfByte);
    DataInputStream localDataInputStream = new DataInputStream(localByteArrayInputStream);
    Account localAccount = new Account();
    localAccount.setMobilePhone(localDataInputStream.readUTF());
    localAccount.setEmail(localDataInputStream.readUTF());
    localByteArrayInputStream.close();
    localDataInputStream.close();
    return localAccount;
  }
}